// Copyright (c) 2020 Presto Labs Pte. Ltd.
// Author: xguo

#pragma once

#include <memory>
#include <string>

#include "coin2/exchange/base/order/order.h"
#include "coin2/exchange/binance_futures/api_order/native_private_client.h"

namespace coin2::exchange::binance_futures::api_order {

class BinanceFuturesRestAsyncAsioSubscriber : public base::order::RestSubscriber {
 public:
  using RestParams = coin2::exchange::order::BinanceFuturesRestParams;
  using RestClient = BinanceFuturesNativePrivateClient;

 public:
  using RestSubscriber::RestSubscriber;
  auto rest_client() { return dynamic_cast<RestClient*>(rest_client_); }
  void QueryBalanceAndPosition();
  void QueryCrossMargin();
  void QueryOpenOrders(const std::string& native_symbol);
  void QueryHistoryOrders(const std::string& native_symbol);
  void QueryFills(const std::string& native_symbol);
  void QueryTransfer();
  void QueryFundingFee();
  void GenListenKey(bool is_init);
  void SubscribeAsync() override;

 private:
  int64_t last_query_transfer_ts_{0};
};

}  // namespace coin2::exchange::binance_futures::api_order
